﻿File file = new File("RegularExpressions.java");
		String str;
        int count = 0;
        try {
        	Scanner sc = new Scanner(file);
        	sc.useDelimiter("[^\\w]+");  // 分割字符串的正则表达式
        	while (sc.hasNext()){ 
        		str = sc.next();
        		System.out.println(str);
        		if (str.matches("\\w*[sS][tT][rR]\\w*")) {  // 要匹配的正则表达式
        			 count ++;
        		}
        	}
        	System.out.println("There are "+count+ " words containing str in the file.");
        } catch (Exception e){
        	System.out.println(e);
        }